package cn.melon.view.admin.store.ctr;

import java.awt.Dialog;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import org.apache.log4j.Logger;

import cn.melon.helper.LoggerHelper;
import cn.melon.mod.store.StoreService;
import cn.melon.mod.store.StoreServiceImpl;
import cn.melon.view.admin.store.AddGoodsDig;
import cn.melon.view.admin.store.StoreJPanel;

public class StorePanelCtr implements ActionListener {

    private String TAG = LoggerHelper.makeLogTag(StorePanelCtr.class);
    private Logger StorePanelCtrLog = LoggerHelper.clientLogger();

    
    private StoreService storeService = new StoreServiceImpl();
    
    private StoreJPanel panel = null;

    public StorePanelCtr(StoreJPanel panel) {
        this.panel = panel;
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        StorePanelCtrLog.info(e.getActionCommand());
        switch (e.getActionCommand()) {
        case "查询":
            StorePanelCtrLog.info(panel.getGoodsType());
            storeService.getGoodsTable(panel,panel.getGoodsType(), 0, 30,panel.getGoodsId(),panel.getGoodsName());
            break;
        case "上架":
            Dialog dialog = new AddGoodsDig();
            dialog.setVisible(true);
            break;
        default:
            break;
        }

    }

}
